Leadtools.Jpeg2000 Requires Document/Medical product license | Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.12.10
ReadFrames(RasterCodecs,String,Generic List,Int32,CodecsLoadByteOrder) Method
See Also  Example
Leadtools.Jpeg2000 Namespace > Jpeg2000Engine Class > ReadFrames Method : ReadFrames(RasterCodecs,String,Generic List,Int32,CodecsLoadByteOrder) Method




codecs
The RasterCodecs object.
fileName
String containing the name of the JPEG 2000 image file which has the frames being loaded.
frames
Frame indices. A list of integers specifying the indices of the frames to be loaded from the file.
bitsPerPixel
Resulting image pixel depth. If this value is zero [0], the image will have the original file’s pixel depth (the image will not be converted).
order

Color order for 16-, 24-, 32-, 48-, and 64-bit images. If the resulting image is less than 16 bits per pixel, this will have no effect since palletized images do not use color order. Valid values are as follows:

ValueMeaning
CodecsLoadByteOrder.RgbRed, green, and blue color order in memory
CodecsLoadByteOrder.BgrBlue, green, and red color order in memory
CodecsLoadByteOrder.Gray12- or 16-bit grayscale image. 12- and 16-bit grayscale images are supported only in the Document/Medical Imaging editions.
CodecsLoadByteOrder.RgbOrGrayLoad the image as red, green, blue OR as a 12- or 16-bit grayscale image. 12- and 16-bit grayscale images are supported only in the Document/Medical Imaging editions.
CodecsLoadByteOrder.BgrOrGrayLoad the image as blue, green, red OR as a 12- or 16-bit grayscale image. 12- and 16-bit grayscale images are supported only in the Document/Medical Imaging editions.
CodecsLoadByteOrder.RommROMM order. ROMM only supports 24- and 48-bit images.
CodecsLoadByteOrder.BgrOrGrayOrRommLoad the image as red, green, blue OR as a 12- or 16-bit grayscale image OR as ROMM. 12- and 16-bit grayscale images are supported only in the Document/Medical Imaging editions. ROMM only supports 24- and 48-bit color images.

Loads specific frame images (i.e. ColorImage, OpacityImage, and PreOpacityImage) from the specified JPEG 2000 file using the specified options.

Syntax

Visual Basic (Declaration) 
Overloads Public Function ReadFrames( _
   ByVal codecs As RasterCodecs, _
   ByVal fileName As String, _
   ByVal frames As List(Of Integer), _
   ByVal bitsPerPixel As Integer, _
   ByVal order As CodecsLoadByteOrder _
) As List(Of CompositeJpxImages)
Visual Basic (Usage)Copy Code
Dim instance As Jpeg2000Engine
Dim codecs As RasterCodecs
Dim fileName As String
Dim frames As List(Of Integer)
Dim bitsPerPixel As Integer
Dim order As CodecsLoadByteOrder
Dim value As List(Of CompositeJpxImages)
 
value = instance.ReadFrames(codecs, fileName, frames, bitsPerPixel, order)
C# 
public List<CompositeJpxImages> ReadFrames( 
   RasterCodecs codecs,
   string fileName,
   List<int> frames,
   int bitsPerPixel,
   CodecsLoadByteOrder order
)
Managed Extensions for C++ 
public: List<CompositeJpxImages>* ReadFrames( 
   RasterCodecs codecs,
   string* fileName,
   List<int>* frames,
   int bitsPerPixel,
   CodecsLoadByteOrder order
) 
C++/CLI 
public:
List<CompositeJpxImages>^ ReadFrames( 
   RasterCodecs codecs,
   String^ fileName,
   List<int>^ frames,
   int bitsPerPixel,
   CodecsLoadByteOrder order
) 

Parameters

codecs
The RasterCodecs object.
fileName
String containing the name of the JPEG 2000 image file which has the frames being loaded.
frames
Frame indices. A list of integers specifying the indices of the frames to be loaded from the file.
bitsPerPixel
Resulting image pixel depth. If this value is zero [0], the image will have the original file’s pixel depth (the image will not be converted).
order

Color order for 16-, 24-, 32-, 48-, and 64-bit images. If the resulting image is less than 16 bits per pixel, this will have no effect since palletized images do not use color order. Valid values are as follows:

ValueMeaning
CodecsLoadByteOrder.RgbRed, green, and blue color order in memory
CodecsLoadByteOrder.BgrBlue, green, and red color order in memory
CodecsLoadByteOrder.Gray12- or 16-bit grayscale image. 12- and 16-bit grayscale images are supported only in the Document/Medical Imaging editions.
CodecsLoadByteOrder.RgbOrGrayLoad the image as red, green, blue OR as a 12- or 16-bit grayscale image. 12- and 16-bit grayscale images are supported only in the Document/Medical Imaging editions.
CodecsLoadByteOrder.BgrOrGrayLoad the image as blue, green, red OR as a 12- or 16-bit grayscale image. 12- and 16-bit grayscale images are supported only in the Document/Medical Imaging editions.
CodecsLoadByteOrder.RommROMM order. ROMM only supports 24- and 48-bit images.
CodecsLoadByteOrder.BgrOrGrayOrRommLoad the image as red, green, blue OR as a 12- or 16-bit grayscale image OR as ROMM. 12- and 16-bit grayscale images are supported only in the Document/Medical Imaging editions. ROMM only supports 24- and 48-bit color images.

Return Value

The CompositeJpxImages list that this method loads.

Example

Visual BasicCopy Code
Leadtools.Jpeg2000.Jpeg2000Engine.ReadFrames(String)
      Private Sub ReadFramesStringExample()
         ' Load a JPEG 2000 image
         Dim engine As New Jpeg2000Engine()
         Dim fileInfo As Jpeg2000FileInformation = engine.GetFileInformation("C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\image1.jpx")
         If (FileInfo.Frame.GetLength(0) < 2) Then
            Return
         End If

         Dim codecs As New RasterCodecs()
         codecs.ThrowExceptionsOnInvalidImages = True
         Dim frames As New List(Of Integer)
         frames.Add(1)
         Dim images As List(Of CompositeJpxImages) = engine.ReadFrames(codecs, "C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\image1.jpx", frames, 0, CodecsLoadByteOrder.BgrOrGray)

         ' Clean up
         Dim _image As CompositeJpxImages
         For Each _image In images
            _image.ColorImage.Dispose()
            _image.OpacityImage.Dispose()
            _image.PreOpacityImage.Dispose()
         Next _image
         codecs.Dispose()
      End Sub
C#Copy Code
Leadtools.Jpeg2000.Jpeg2000Engine.ReadFrames(String) 
      private void ReadFramesStringExample() 
      { 
         // Load a JPEG 2000 image 
         Jpeg2000Engine engine = new Jpeg2000Engine(); 
         Jpeg2000FileInformation fileInfo = engine.GetFileInformation(@"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\image1.jpx"); 
         if (fileInfo.Frame.GetLength(0) < 2) 
            return; 
 
         RasterCodecs codecs = new RasterCodecs(); 
         codecs.ThrowExceptionsOnInvalidImages = true; 
         List<int> frames = new List<int>(); 
         frames.Add(1); 
         List<CompositeJpxImages> images = engine.ReadFrames(codecs,@"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\image1.jpx",frames,0,CodecsLoadByteOrder.BgrOrGray); 
         // Clean up 
         foreach (CompositeJpxImages image in images) 
         { 
            image.ColorImage.Dispose(); 
            image.OpacityImage.Dispose(); 
            image.PreOpacityImage.Dispose(); 
         } 
         codecs.Dispose(); 
      }

Remarks

All engine boxes will be reset.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Leadtools.Jpeg2000 requires a Document or Medical toolkit license and unlock key. For more information, refer to: Raster Pro/Document/Medical Features